package com.netease.nim.demo.session.viewholder;

import android.view.View;

import com.netease.nim.demo.session.model.extension.GuessAttachment;
import com.shwread.android.qysw10000204.R;


/**
 * Created by zhoujianghua on 2015/4/10.
 */
public class MsgViewHolderGuessRight
        extends
        MsgViewHolderTextRight
{
	
	@Override
	protected void refresh(Object item) {
		super.refresh(item);
		GuessAttachment attachment = (GuessAttachment) messageItem.getMessage().getAttachment();
		
		int text = attachment.getValue().getValue();
		
		textMessageTextView.setVisibility(View.GONE);
		textMessageImageView.setVisibility(View.VISIBLE);
		textMessageImageView.setImageDrawable(context.getResources().getDrawable(getId(text)));
	}
	
	int getId(int guess) {
		int drawableId = 0;
		switch (guess) {
			case 1:
				drawableId = R.drawable.custom_msg_ken;
				break;
			case 2:
				drawableId = R.drawable.custom_msg_jan;
				break;
			case 3:
				drawableId = R.drawable.custom_msg_pon;
				break;
		}
		return drawableId;
	}
	
}
